<%--
  Created by IntelliJ IDEA.
  User: 李林
  Date: 2020/4/23
  Time: 23:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>ERP后台主页</title>
    <meta name="description" content="ERP后台主页">
    <meta name="keywords" content="ERP后台主页">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">

    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/iCheck/square/blue.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/morris/morris.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/datepicker/datepicker3.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/daterangepicker/daterangepicker.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/treeTable/jquery.treetable.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/treeTable/jquery.treetable.theme.default.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/select2/select2.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/colorpicker/bootstrap-colorpicker.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/css/style.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/ionslider/ion.rangeSlider.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/ionslider/ion.rangeSlider.skinNice.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/bootstrap-slider/slider.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/pages/plugins/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/pages/plugins/layui/layui.js "></script>
    <script src="${pageContext.request.contextPath}/pages/plugins/echarts/echarts.min.js "></script>
</head>

<body class="hold-transition skin-yellow-light sidebar-mini">

<div class="wrapper">

    <!-- 页面头部 -->
    <jsp:include page="../header.jsp"></jsp:include>
    <!-- 页面头部 /-->

    <!-- 导航侧栏 -->
    <jsp:include page="../aside.jsp"></jsp:include>
    <!-- 导航侧栏 /-->

    <!-- 内容区域 -->
    <div class="content-wrapper onjsp">

        <!-- ========================================== -->
        <section class="content-header">
            <h1>
                财务详情
                <small>Financial details</small>
            </h1>
            <ol class="breadcrumb">
                <%--<li><a href="all-admin-index.html"><i class="fa fa-dashboard"></i> 首页</a></li>--%>
            </ol>
        </section>
        <section class="content">
            <div class="row" id="xiangqing">

            </div>
            <div class="row" style=" height: 550px;">
                <div class="col-md-7" style="margin-left: -5px;">
                    <div class="layui-card col-md-12" style="height: 550px;">
                        <div class="layui-tab layui-tab-brief layui-card-hard">
                            <ul class="layui-tab-title ">
                                <li class="layui-this">最近营收</li>
                                <li>最近利润</li>
                                <li>账单合计</li>
                                <li>添加账单</li>
                            </ul>
                            <div class="layui-tab-content layui-card-body" style="height: 100px;">
                                <div class="layui-tab-item layui-show" id="item1">
                                    <div class="box-body chart-responsive">
                                        <div class="chart" id="income-line-chart" style="height: 300px;"></div>
                                    </div>
                                </div>
                                <div class="layui-tab-item " id="item2">
                                    <div id="main1" style="height: 500px;width:900px;"></div>
                                </div>
                                <div class="layui-tab-item" id="item3">
                                    <div id="tongji" style="width: 600px;height:400px;"></div>
                                </div>
                                <div class="layui-tab-item" id="item4">
                                    <form class="form-horizontal" id="financial_form">
                                        <div class="box-body" style="width: 100%;">
                                            <div class="divcenter" style="width: 600px;margin: 0 auto;height: 350px;padding-top: 15px;">
                                                <div class="form-group" style="margin: 20px 10px 10px 10px ;">
                                                    <label for="fname" class="col-sm-2 control-label">账单名</label>
                                                    <div class="col-sm-10">
                                                        <input type="text" class="form-control" id="fname" name="fname" placeholder="账单名">
                                                    </div>
                                                </div>

                                                <div class="form-group" style="margin: 20px 10px 10px 10px ;">
                                                    <label for="ie" class="col-sm-2 control-label">收支类别</label>
                                                    <div class="col-sm-10">
                                                        <select name="ie" id="ie" class="form-control">
                                                            <option selected value="1">应收</option>
                                                            <option value="2">应付</option>
                                                            <option value="3">已收</option>
                                                            <option value="4">已付</option>
                                                        </select>
                                                    </div>
                                                </div>

                                                <div class="form-group" style="margin: 20px 10px 10px 10px ;">
                                                    <label for="amount" class="col-sm-2 control-label">金额</label>
                                                    <div class="col-sm-10">
                                                        <input type="email" class="form-control" id="amount" name="amount" placeholder="金额">
                                                    </div>
                                                </div>

                                                <div class="form-group" style="margin: 20px 10px 10px 10px ;">
                                                    <label for="comment" class="col-sm-2 control-label">备注</label>
                                                    <div class="col-sm-10">
                                                        <input type="text" class="form-control" id="comment" name="comment" placeholder="备注">
                                                    </div>
                                                </div>

                                                <div class="form-group" style="margin: 20px 10px 10px 10px ;">
                                                    <label for="kind" class="col-sm-2 control-label">账单类别</label>
                                                    <div class="col-sm-10">
                                                        <select name="kind" id="kind" class="form-control">
                                                            <option selected value="1">出货</option>
                                                            <option value="2">进货</option>
                                                            <option value="3">下午茶</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- /.box-body -->
                                            <div class="box-footer text-center" style="margin-top: 50px;">
                                                <button type="button" class="btn btn-default " style="width: 82px;">清空</button>
                                                <button type="button" class="btn btn-info " onclick="addfinancial()" style="width: 82px;">提交</button>
                                            </div>
                                            <!-- /.box-footer -->
                                        </div>
                                    </form>
                                </div>

                            </div>
                        </div>

                    </div>
                </div>
                <div class="col-md-5" style="height: 550px;padding-left: 0px;padding-right: 5px">
                    <div class="layui-card">
                        <div class="layui-card-hard">
                            <div style="margin:0 10px 5px 10px;border-bottom: 1px solid #e6e6e6;line-height: 40px;font-size: 14px;padding-left: 10px;">最近账单
                            </div>
                            <div class=" layui-card-body">
                                <table id="financial_tab" lay-filter="demo" ></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- ========================================== -->


</div>
    <!-- 内容区域 /-->

    <!-- 底部导航 -->
    <jsp:include page="../foot.jsp"></jsp:include>
    <!-- 底部导航 /-->

</div>


<script src="${pageContext.request.contextPath}/pages/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/jQueryUI/jquery-ui.min.js"></script>
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/raphael/raphael-min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/morris/morris.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/knob/jquery.knob.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/daterangepicker/moment.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/daterangepicker/daterangepicker.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/fastclick/fastclick.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/iCheck/icheck.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/adminLTE/js/app.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/treeTable/jquery.treetable.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/select2/select2.full.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-markdown/js/markdown.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-markdown/js/to-markdown.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/ckeditor/ckeditor.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/input-mask/jquery.inputmask.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/chartjs/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/flot/jquery.flot.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/flot/jquery.flot.resize.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/flot/jquery.flot.pie.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/flot/jquery.flot.categories.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/ionslider/ion.rangeSlider.min.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-slider/bootstrap-slider.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/pages/plugins/baiduTemplate/baiduTemplate.js"></script>
<script>
    $(document).ready(function() {
        // 选择框
        $(".select2").select2();

        // WYSIHTML5编辑器
        $(".textarea").wysihtml5({
            locale: 'zh-CN'
        });
    });

    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }

    $(document).ready(function() {
        // 激活导航位置
        setSidebarActive("admin-index");
    });
</script>
</body>
</html>
<script>
    layui.use('element', function() {
        var $ = layui.jquery,
            element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
    });
</script>
<script type="text/template" id="row_xiangqing">
    <div class="col-md-3" style="padding:0;">
        <div class="layui-card" style="height: 155px;margin: 10px;padding-left: 0px;">
            <div class="layui-card-hard " style="margin:0 10px 5px 10px;border-bottom: 1px solid #e6e6e6;line-height: 40px;font-size: 14px;padding-left: 10px;">
                今日利润
            </div>
            <div class="layui-card-body">
                <p style="line-height: 36px;font-size: 36px;color: #666;text-overflow:ellipsis;margin: 10px 10px 15px 5px ;">
                    <~=profit~><span style="position:absolute;right: 15px;">元</span>
                </p>
                <p>
                    昨日利润
                    <span style="position:absolute;right: 15px;"><~=zprofit~> <i class="layui-icon">元</i></span>
                </p>
            </div>
        </div>
    </div>
    <div class="col-md-3" style="padding:0;">
        <div class="layui-card" style="height: 155px;margin: 10px;padding-left: 0px;">
            <div class="layui-card-hard " style="margin:0 10px 5px 10px;border-bottom: 1px solid #e6e6e6;line-height: 40px;font-size: 14px;padding-left: 10px;">
                月度利润
            </div>
            <div class="layui-card-body">
                <p style="line-height: 36px;font-size: 36px;color: #666;text-overflow:ellipsis;margin: 10px 10px 15px 5px ;">
                    <~=profit~><span style="position:absolute;right: 15px;">元</span>
                </p>
                <p>
                    上月利润
                    <span style="position:absolute;right: 15px;"><~=zprofit~> <i class="layui-icon">元</i></span>
                </p>
            </div>
        </div>
    </div>
    <div class="col-md-3" style="padding:0;">
        <div class="layui-card" style="height: 155px;margin: 10px;padding-left: 0px;">
            <div class="layui-card-hard " style="margin:0 10px 5px 10px;border-bottom: 1px solid #e6e6e6;line-height: 40px;font-size: 14px;padding-left: 10px;">
                今日营收
            </div>
            <div class="layui-card-body">
                <p style="line-height: 36px;font-size: 36px;color: #666;text-overflow:ellipsis;margin: 10px 10px 15px 5px ;">
                    <~=yishou~><span style="position:absolute;right: 15px;">元</span>
                </p>
                <p>
                    昨日营收
                    <span style="position:absolute;right: 15px;"><~=zyishou~></span>
                </p>
            </div>
        </div>
    </div>
    <div class="col-md-3" style="padding:0;">
        <div class="layui-card" style="height: 155px;margin: 10px;padding-left: 0px;">
            <div class="layui-card-hard " style="margin:0 10px 5px 10px;border-bottom: 1px solid #e6e6e6;line-height: 40px;font-size: 14px;padding-left: 10px;">
                未收账目
            </div>
            <div class="layui-card-body">
                <p style="line-height: 36px;font-size: 36px;color: #666;text-overflow:ellipsis;margin: 10px 10px 15px 5px ;">
                    <~=yingshou~><span style="position:absolute;right: 15px;">元</span>
                </p>
                <p>
                    未付账目
                    <span style="position:absolute;right: 15px;"><~=yingfu~></span>
                </p>
            </div>
        </div>
    </div>
</script>

<script type="text/template" id="tanchuang">
    <div id="tc_div">
        <div class="row" style="margin:20px 0 5px 0;"><div class="col-md-5"><p>账单ID：</p></div><div class="col-md-7"><span><~=fid~></span></div></div>
        <div class="row"><div class="col-md-5"><p>账单名称：</p></div><div class="col-md-7"><span><~=fname~></span></div></div>
        <div class="row"><div class="col-md-5"><p>收支类型：</p></div><div class="col-md-7">
            <span>
                <~ if(ie == 1)~>未收<~ ;~>
                <~ if(ie == 2)~>已收<~ ;~>
                <~ if(ie == 3)~>未付<~ ;~>
                <~ if(ie == 4)~>已付<~ ;~>
            </span></div></div>
        <div class="row"><div class="col-md-5"><p>创建日期：</p></div><div class="col-md-7"><span><~=createtime~></span></div></div>
        <div class="row"><div class="col-md-5"><p>更新时间：</p></div><div class="col-md-7"><span><~=updatetime~></span></div></div>
        <div class="row"><div class="col-md-5"><p>操作员：</p></div><div class="col-md-7"><span><~=userInfo.name~></span></div></div>
        <div class="row"><div class="col-md-5"><p>金额：</p></div><div class="col-md-7"><span><~=amount~></span></div></div>
        <div class="row"><div class="col-md-5"><p>账单类别：</p></div><div class="col-md-7"><span><~=kindStr~></span></div></div>
        <div class="row"><div class="col-md-5"><p>备注：</p></div><div class="col-md-7"><span><~=comment~></span></div></div>
    </div>
    <style>
        #tc_div .row{
            margin:10px 0 5px 0 ;
            line-height: 40px;
            font-size: 18px;
        }
        #tc_div p{
            text-align: right;
            font-weight: 600;
        }
    </style>
</script>
<script>
    $(function () {
        layui.use('layer', function() {
            var layer = layui.layer;
        });
        days();
        ftable();
        financialcharts();
        statistics();
    });
    //当天财务数据
    function days() {
        $.get("days",{},function (result) {
            var today = result.resultList["today"];
            var yesterday = result.resultList["yesterday"];
            var data= {};
            if(today == null || yesterday == null)return;
            for(var i=0;i<today.length;i++){
                if(today[i].sign == 1){
                    data.profit = today[i].amount;
                }
                if(today[i].sign == 2){
                    data.yingshou = today[i].amount;
                }
                if(today[i].sign == 3){
                    data.yingfu = today[i].amount;
                }
                if(today[i].sign == 4){
                    data.yishou = today[i].amount;
                }
                if(today[i].sign == 5){
                    data.yifu = today[i].amount;
                }
            }
            for(var j=0;j<yesterday.length;j++){
                if(yesterday[j].sign == 1){
                    data.zprofit = yesterday[j].amount;
                }
                if(yesterday[j].sign == 4){
                    data.zyishou = yesterday[j].amount;
                }
            }
            var bt = baidu.template;
            var html = bt("row_xiangqing",data);
            $("#xiangqing").html(html);
        })
    }
    //获取账单数据
    function ftable() {
        $.get("ftable",{},function (result) {
            var list = result.resultList["ftable"];
            showfinancial(list);
        })
    }
    //展示账单table
    function showfinancial(data) {
        layui.use('table', function(){
            var table = layui.table;
            //第一个实例
            table.on('tool(demo)', function(obj){
                var data = obj.data;
                if(obj.event === 'detail'){
                    detailCaozuo(data,1);
                }
            });
            table.render({
                elem: '#financial_tab'
                // ,height: 312
                ,page: true //开启分页
                ,cellMinWidth: 70
                ,cols: [[ //表头
                    {field: 'fid', title: 'ID', fixed: 'left',width:50}
                    ,{field: 'fname', title: '账单名',templet: function(d){
                        // console.log(d);
                            return '<a href="#" lay-event="detail">'+d.fname+'</a>';
                        }}
                    ,{field: 'createtime', title: '日期'}
                    ,{field: 'userInfo', title: '操作员' ,templet: function(d){
                            return d.userInfo.name;
                        }}
                    ,{field: 'amount', title: '金额'}
                    ,{field: 'kindStr', title: '账单类别'}
                    ,{field: 'ie', title: '收支类别' ,hide:'false'}
                    ,{field: 'updatetime', title: '更新时间',hide:'false'}
                    ,{field: 'comment', title: '备注',hide:'false'}
                ]]
                ,data:data
            });

        });
    }
    //弹窗操作
    function detailCaozuo(data,sign) {
        var bt = baidu.template;
        var html = bt("tanchuang",data);
        layer.open({
            type: 1,
            title: ['账单详情', 'font-size:18px;'],
            content: html,
            area: ['600px', '550px'],
            closeBtn: 1,
            shade: [0.3, '#393D49'],
            shadeClose: true,
            anim: 1,
        });
    }

    //图表
    function financialcharts() {
        $.get("recently",{},function (result) {
            var income = result.resultList["income"];
            // incomelist = result.resultList["income"];
            var profit = result.resultList["profit"];
            profitlist = result.resultList["profit"];
            // alert(123)
            income_linechart(income);
            profit_linechart(profit);
        })
    }
    //收入图表 使用的Morris
    function income_linechart(list) {
        // console.log(list);

        var listStr = [];
        for(var i = 0 ; i <list.length;i++){
            listStr.push({y: ''+list[i].dateStr,item1: ''+list[i].amount })
        }
        var income_line = new Morris.Line({
            element: 'income-line-chart',
            resize: true,
            data: listStr,
            xkey: 'y',
            ykeys: ['item1'],
            labels: ['收入'],
            lineColors: ['#3c8dbc'],
            hideHover: 'auto',
            units: '元'
        });
        console.log(income_line);
    }
    //利润图标 使用的Echarts
    function profit_linechart(list) {
        var amount = [];
        var time = [];
        for(var i = 0 ; i <list.length;i++){
            amount.push(list[i].amount );
            time.push(list[i].dateStr)
        }
        var myChart1 = echarts.init(document.getElementById('main1'));
        myChart1.setOption({
            title: {
                text: '利润'
            },
            tooltip: {},
            toolbox: {
                feature: {
                    dataView: {},
                    saveAsImage: {
                        pixelRatio: 2
                    },
                    restore: {}
                }
            },
            xAxis: {
                data:time
            },
            yAxis: {},
            series: [{
                type: 'line',
                smooth: true,
                data:amount
            }],
            grid: {
                top: '10%',
                left: '10%',
                width: 750,
                // right: '15%',
                bottom: '20%'
            }
        });
    }

    function addInit() {

    }

    function addfinancial() {
        $.post("add",$("#financial_form").serialize(),function (result) {
            alert(result.message);
            window.location.href = 'financial';
        })
    }

    function statistics() {
        $.get("statistics",{},function (result) {
            var statistics = result.resultList["statistics"];
            var pd = [];
            for(var i = 0 ;i<statistics.length;i++){
                if(statistics[i].sign == 1){
                    pd.push({name:'利润',value:statistics[i].amount})
                }
                if(statistics[i].sign == 2){
                    pd.push({name:'应收',value:statistics[i].amount})
                }
                if(statistics[i].sign == 3){
                    pd.push({name:'应付',value:statistics[i].amount})
                }
                if(statistics[i].sign == 4){
                    pd.push({name:'已收',value:statistics[i].amount})
                }
                if(statistics[i].sign == 5){
                    pd.push({name:'已付',value:statistics[i].amount})
                }
            }
            console.log(pd);
            echarts.init(document.getElementById('tongji')).setOption({
                series: {
                    type: 'pie',
                    data: pd
                }
            });
        })

    }
</script>